Click here to Skip to main content
15,886,873 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Strolling off the edge Pin
honey the codewitch5-Apr-23 15:03
mvahoney the codewitch5-Apr-23 15:03 
GeneralRe: Strolling off the edge Pin
jschell6-Apr-23 5:14
jschell6-Apr-23 5:14 
GeneralRe: Strolling off the edge Pin
honey the codewitch6-Apr-23 10:04
mvahoney the codewitch6-Apr-23 10:04 
GeneralRe: Strolling off the edge Pin
jschell7-Apr-23 9:10
jschell7-Apr-23 9:10 
GeneralRe: Strolling off the edge Pin
jmaida5-Apr-23 10:32
jmaida5-Apr-23 10:32 
GeneralRe: Strolling off the edge Pin
honey the codewitch5-Apr-23 10:37
mvahoney the codewitch5-Apr-23 10:37 
JokeRe: Strolling off the edge Pin
FreedMalloc5-Apr-23 10:57
FreedMalloc5-Apr-23 10:57 
GeneralRe: Strolling off the edge Pin
honey the codewitch5-Apr-23 11:09
mvahoney the codewitch5-Apr-23 11:09 
Specifically

C++
static void wav_voice_16_1_to_16_2(const voice_func_info_t& info, void*state) {
    wav_info_t* wi = (wav_info_t*)state;
    if(!wi->loop&&wi->pos>=wi->length) {
        return;
    }
    uint16_t* dst = (uint16_t*)info.buffer;
    for(int i = 0;i<info.frame_count;++i) {
        int16_t i16;
        if(wi->pos>=wi->length) {
            if(!wi->loop) {
                break;
            }
            wi->on_seek_stream(wi->start,wi->on_seek_stream_state);
            wi->pos = 0;
        }
        if(player_read16s(wi->on_read_stream,wi->on_read_stream_state,&i16)) {
            wi->pos+=2;
        } else {
            break;
        }
        uint16_t u16 = (uint16_t)((i16+32768U)*wi->amplitude);
        for(int j=0;j<info.channels;++j) {
            *dst+=u16;
            ++dst;
            // YIKES! I lost track of the loop i was in and tried
            // writing out both channels here. removing these
            // two lines fixes it:
            *dst+=u16;
            ++dst;

        }
    }
}

To err is human. Fortune favors the monsters.

GeneralRe: Strolling off the edge Pin
Kenneth Haugland5-Apr-23 11:24
mvaKenneth Haugland5-Apr-23 11:24 
GeneralRe: Strolling off the edge Pin
jmaida5-Apr-23 15:26
jmaida5-Apr-23 15:26 
GeneralRe: Strolling off the edge Pin
honey the codewitch5-Apr-23 15:34
mvahoney the codewitch5-Apr-23 15:34 
GeneralRe: Strolling off the edge Pin
jmaida5-Apr-23 16:04
jmaida5-Apr-23 16:04 
GeneralRe: Strolling off the edge Pin
den2k885-Apr-23 21:42
professionalden2k885-Apr-23 21:42 
GeneralRe: Strolling off the edge Pin
jmaida6-Apr-23 6:42
jmaida6-Apr-23 6:42 
GeneralRe: Strolling off the edge Pin
BernardIE53176-Apr-23 3:09
BernardIE53176-Apr-23 3:09 
GeneralRe: Strolling off the edge Pin
honey the codewitch6-Apr-23 10:09
mvahoney the codewitch6-Apr-23 10:09 
GeneralRe: Strolling off the edge Pin
BernardIE53176-Apr-23 11:45
BernardIE53176-Apr-23 11:45 
GeneralRe: Strolling off the edge Pin
jeron16-Apr-23 12:25
jeron16-Apr-23 12:25 
GeneralRe: Strolling off the edge Pin
jschell7-Apr-23 9:35
jschell7-Apr-23 9:35 
GeneralRe: Strolling off the edge Pin
jschell7-Apr-23 9:34
jschell7-Apr-23 9:34 
GeneralRe: Strolling off the edge Pin
BernardIE53177-Apr-23 11:01
BernardIE53177-Apr-23 11:01 
GeneralRe: Strolling off the edge Pin
240DL6-Apr-23 4:23
240DL6-Apr-23 4:23 
GeneralRe: Strolling off the edge Pin
honey the codewitch6-Apr-23 10:05
mvahoney the codewitch6-Apr-23 10:05 
GeneralRe: Strolling off the edge Pin
englebart7-Apr-23 13:44
professionalenglebart7-Apr-23 13:44 
GeneralPython problems... Pin
glennPattonWork35-Apr-23 0:16
professionalglennPattonWork35-Apr-23 0:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.